package com.blb.day20231102springboot.controller;

import com.blb.day20231102springboot.mapper.EmployeeMapper;
import com.blb.day20231102springboot.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;
import java.util.List;

@Controller
public class PageController {

    @Autowired
    private EmployeeMapper employeeMapper;

    @RequestMapping("/findEmployees")
    public String toHello(Model model){
        model.addAttribute("message","Hello World");
        List<Employee> employees = employeeMapper.selectList(null);
        model.addAttribute("employees",employees);
        return "hello";
    }
}
